// MorphologyProj.cpp: 定义控制台应用程序的入口点。
//

#include "stdafx.h"

#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>

#include "Morphology.h"

using namespace cv;
using namespace std;

int main()
{
	Mat binary_image = (Mat_<uchar>(8, 8) <<
		0, 0, 0, 0, 0, 0, 0, 0,
		1, 1, 1, 1, 1, 1, 1, 0,
		0, 0, 0, 1, 1, 1, 1, 0,
		0, 0, 0, 1, 1, 1, 1, 0,
		0, 0, 1, 1, 1, 1, 1, 0,
		0, 0, 0, 1, 1, 1, 1, 0,
		0, 0, 1, 1, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0);
	Mat structuring_element = (Mat_<uchar>(3, 3) << 
		1, 1, 1,
		1, 1, 1,
		1, 1, 1);

	Morphology mor;
	Mat r1 = mor.Closing(binary_image, structuring_element);
	Mat r2 = mor.Opening(binary_image, structuring_element);
	cout << "result1 = " << r1 << endl;
	cout << "result2 = " << r2 << endl;
    return 0;
}

